define([],function (){
    // var menu = {
    //     msg(){
    //         console.log("消息测试")
    //     }
    // }
    // var strs = '<span v-for="item in list">' +
    //     '<el-sub-menu v-if="item.children&&item.children.length>0" :index="item.id">' +
    //     '<template #title @click="addMain(item.title,item.module,item.route,item.route)">{{item.title}}</template>' +
    //     '<allmenu :list="item.children"></allmenu>' +
    //     '</el-sub-menu>' +
    //     '<el-menu-item v-else :index="item.id" @click="addMain(item.title,item.module,item.route,item.id)">{{item.title}}</el-menu-item>' +
    //     '</span>'
    // var strs = '<span v-for="item in list">{{item.title}}</span>'
    var strs = '<el-sub-menu v-if="item.children&&item.children.length>0" :index="item.id" popper-append-to-body>' +
        '<template #title @click="addMain(item.title,item.module,item.route,item.route)">{{item.title}}</template>' +
        '<allmenu v-for="items in item.children" :item="items"></allmenu>' +
        '</el-sub-menu>' +
        '<el-menu-item v-else :index="item.id" @click="addMain(item.title,item.module,item.route,item.id)">{{item.title}}</el-menu-item>'
    var allmenu = {
        components:{allmenu},
        template: strs,
        data: function() {
            return {

            };
        },
        props: {
            item:{
                type: Object,
                default: null
            },
        },
        created(){
            let that = this
            setTimeout(()=>{
                console.log(that.item,'lllllllllllllllllllllll')
            },1000)
        },
        methods:{
            addMain(title,module,route,id){
                this.$emit('addMain',title,module,route,id)
            }
        }
    };
    return allmenu;
})